
import pygtk
pygtk.require('2.0')
import gtk, gobject, cairo, math, rsvg
from gtk import gdk
import gobject #, SIGNAL_RUN_FIRST

from cairowidget.basewidget import *

from sys import *
#from xml.sax import *
import xml.parsers.expat


def start_element(name, attrs):
    print 'Start element:', name, attrs
def end_element(name):
    print 'End element:', name
def char_data(data):
    print 'Character data:', repr(data)

p = xml.parsers.expat.ParserCreate()

p.StartElementHandler = start_element
p.EndElementHandler = end_element
p.CharacterDataHandler = char_data

StringIO("test.xml")

p.Parse("""<?xml version="1.0"?>
<parent id="top"><child1 name="paul">Text goes here</child1>
<child2 name="fred">More text</child2>
</parent>""", 1)

#print reader.getContentHandler()

if __name__ == "__main__":
    win = CairoWindow()
    win.set_background_svg("player.svg")
    w = TestWidget()
    w.set_position(15,25)
    win.add_cairowidget(w)
    def click(w,e):
        print "Widget click",w,e
    w.connect("clicked",click)
    win.show_all()
    gtk.main()
